package base.collection_demo.demo03;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Person {
    private String name;
    private Integer age;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        boolean result = name.equals(person.name) && age.equals(person.age);
        return result;
    }

    @Override
    public int hashCode() {
        int hash = Objects.hash(name, age);
//        System.out.println("HASH: "+hash);
        return hash;
    }

    public static void main(String[] args) {

    }
}
